<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<style type="text/css">
		body, html {width: 100%;height: 100%;margin:0;font-family:"微软雅黑";}
		#allmap{width:100%;height:500px;}
		p{margin-left:5px; font-size:14px;}
	</style>
	<link rel="stylesheet" href="layui/css/layui.css" media="all">
	<script type="text/javascript" src="../../../js/jquery-2.1.4.js" ></script>
	<script type="text/javascript" src="../../../js/layer/layer.js" ></script>
	<title>根据关键字本地搜索</title>
	<style type="text/css">
		span{
			font-size: 16px;
		}
		a{
			font-size: 16px;
			color: red;
		}
		   li {
            border: solid 1px rgb(237,237,237);
            border-bottom-width: 0px;
            height: 80px;
            line-height: 80px;
            position: relative;
        }
        li:hover{
        	background-color: rgb(237,237,237);
        }
        .addimg{
        	position: absolute;
        	left: 280px;
        	top: 16px;
        }
        .jdimg{
        	position: absolute;
        	top: 5px;
        	left: 5px;
        }
        .wz{
        	position: absolute;
        	left: 80px;
        }
	</style>
</head>
<body>
	<!--<button type="button" class="layui-btn layui-btn-xs addday">点击获取数据</button>-->
	<input type="text" name="title" required lay-verify="required" placeholder="请输入地点" autocomplete="off" class="layui-input address">  
	&nbsp;<span><b>热门</b></span> &nbsp;<a>重庆</a>&nbsp;<a>北京</a>&nbsp;<a>上海</a>&nbsp;<a>深圳</a>&nbsp;<a>广州</a> 
	<div >
		<ul class="ull">
		<li class="qq"><a href="javascript:void(0);"><img src="../../../img/9zai1.jpg"/></a><div class="wz" style="display:inline-block;"><a href="javascript:void(0);">九寨沟</a></div><div style="display:inline-block;" >1</div></li>
		<li>  <div class="jdimg" style="display:inline-block;background-image:url(../../../img/wait.jpg);width: 70px;height: 70px;"  ><a href="javascript:void(0);"></a></div>  <div style="display:inline-block;"><a href="javascript:void(0);">磁器口</a></div><div style="display:inline-block;" >1</div></li>
		<li><a href="javascript:void(0);"><img src="../../../img/huangs.jpg"/></a><div style="display:inline-block;"><a href="javascript:void(0);">黄山</a></div><div style="display:inline-block;" >1</div></li>	
		<li><a href="javascript:void(0);"><img src="../../../img/huas.jpg"/></a><div style="display:inline-block;"><a href="javascript:void(0);">华山</a></div><div style="display:inline-block;" >1</div></li>	
		<li><a href="javascript:void(0);"><img src="../../../img/wait.jpg"/></a><div style="display:inline-block;"><a href="javascript:void(0);">外滩</a></div><div style="display:inline-block;" >1</div></li>	
		<li><a href="javascript:void(0);"><img src="../../../img/songsan.jpg"/></a><div style="display:inline-block;"><a href="javascript:void(0);">嵩山</a></div><div style="display:inline-block;" >1</div></li>	
		<li><a href="javascript:void(0);"><img src="../../../img/9zai1.jpg"/></a><div style="display:inline-block;"><a href="javascript:void(0);">九寨沟</a></div><div style="display:inline-block;" >1</div></li>
		</ul>
	</div>
	
</body>
<script>
	/*$(".addday").click(function(){
		console.log(parent.PartitionId);
	})*/
	$(".address").bind('input propertychange',function(){
	var address=$(this).val();
		parent.getChildrenData(address);//data为需要传递的值
		addjd(address);
		
		
	})
	$(".address").blur(function(){
		var startaddress=$(this).val();
			parent.getChildrenDatastart(startaddress);//data为需要传递的值
	})
var addjd=	function(address){
			var url = "https://search.heweather.net/find?" ;
			$.ajax({
                url: url,
                type: "post",
                dataType: 'json',
                data: {
                    location:address, //景区名称或者地址,非必填
                    key:"f6c5564f94844ff8a1d2d7f780d36bda",
                    number:20 //最大值为20
                },
                success: function (data) {
                	parent.getChildrenDatall(data);//datall为需要传递的值
	                  /* console.log(data.HeWeather6[0].basic.length);*/
                    //处理数据 遍历后显示到框上
                    var jd=[];
                    for(var i=0;i<data.HeWeather6[0].basic.length;i++){
                    	var q=data.HeWeather6[0].basic[i];
                    	console.log(q);
                    	//lon 经度   lat 纬度
                    	jd.push('<li  qq='+q.location+'><div class="jdimg" style="display:inline-block;background-image:url(../../../img/wait.jpg);width: 70px;height: 70px;"  ><a href="javascript:void(0);"></a></div> <div class="wz"  style="display:inline-block;"><a href="javascript:void(0);">'+q.location+'</a></div><div class="addimg" style="display:inline-block;" lat='+q.lat+' lon='+q.lon+' ><img src="../../../img/add.png" /></div></li>')
                    }
                    $(".ull").html(jd.join(""));
                },
                error: function (xhr, type, errorThrown) {
                    alert('识别失败');
                }
            });
	}
//调用父页面 生成行程页******************************************************************
//code为行程页面状态码，默认为0  1表示开启
var code=1;
	$(".ull").on("click","li",function(){
		 //获取li中内容
	var  index= parent.PartitionId;
	console.log(parent.PartitionId);
	var startaddr=  $(this).attr("qq");
	console.log(startaddr);
	if(code == index){
		console.log("在一次执行了code这个方法");
   		 //在父层弹出一个层
    	parent.zfym(startaddr,index);
    	code =0;
    }else{
    	console.log("else")
    	//追加旅游地点的方法
    parent.bid(startaddr,index);
    	
    }
		
	});


		</script>
</html>

